<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>求数组所有平均数/和</title>
	</head>
	<body>
		<script>
			var arr=[10,20,30];
			var sum=0;
			for(var i=0;i<arr.length;i++){
				sum+=arr[i]
			}
			console.log(sum);
			var avg=sum/arr.length;
			console.log(avg);
		</script>
	</body>
</html>
